<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { ArrowRight } from '@element-plus/icons-vue'

const router = useRouter()
const inputText = ref('')

const handleSend = () => {
  if (inputText.value.trim()) {
    router.push({
      path: '/chat',
      query: { q: inputText.value }
    })
  }
}
</script>

<template>
  <div class="home-container">
    <div class="input-section">
      <div class="input-wrapper">
        <!-- 上半部分：输入区域 -->
        <el-input
          v-model="inputText"
          type="textarea"
          :autosize="{ minRows: 1, maxRows: 7 }"
          placeholder="输入你的问题"
          class="wide-input"
          resize="none"
        />
        <!-- 下半部分：操作栏 -->
        <div class="action-bar">
  
                <el-button 
                type="primary" 
                @click="handleSend"
                :icon="ArrowRight"
                circle
                class="send-button"
                />
           
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.home-container {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.input-section {
  width: 100%;
  max-width: 1000px;
  display: flex;
  justify-content: center;
}

.input-wrapper {
  width: 100%;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden; /* 确保圆角效果 */
}

/* 输入区域样式 */
.wide-input :deep(.el-textarea__inner) {
  width: 100%;
  font-size: 16px;
  padding: 16px 20px;
  border: none;
  outline: none;
  color: #333;
  resize: none;
  line-height: 1.5;
  min-height: 60px;
  background: transparent; /* 透明背景 */
  box-shadow: none; /* 移除阴影 */
}

/* 操作栏样式 */
.action-bar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 16px;
  background: #fff;
}

/* 发送按钮样式 */
/* 修复圆形按钮样式 */
.send-button {
  width: 40px;
  height: 40px;
  min-width: 40px; /* 新增：防止宽度被压缩 */
  padding: 0; /* 确保内边距为零 */
  background-color: #409EFF;
  color: white;
  border: none;
  border-radius: 50%; /* 强制圆形 */
}

/* 覆盖Element Plus可能影响圆形的样式 */
.send-button.is-circle {
  border-radius: 50%;
  padding: 0;
}
.send-button:hover {
  background-color: #66b1ff;
}
</style>